package com.zxc.demo4.advice;

import org.springframework.aop.AfterReturningAdvice;
import org.springframework.aop.MethodBeforeAdvice;

import java.lang.reflect.Method;
import java.util.Date;


/**
  * @author: zxc
  * @return:
  * @time:  2021/5/17 15:48
  * @description: 前置增强
  */
public class BeforeShow implements MethodBeforeAdvice, AfterReturningAdvice {
    @Override
    public void before(Method method, Object[] args, Object target) throws Throwable {
        //oop   3
        System.out.println("我来记录日志");
        System.out.println(new Date()+":执行了-->"+method.getName()+"方法");
    }

    @Override
    public void afterReturning(Object returnValue, Method method, Object[] args, Object target) throws Throwable {
        System.out.println("----------------------");
        System.out.println("----------------------");
        System.out.println("这个是新的后置增强");
        System.out.println("----------------------");
        System.out.println("----------------------");
    }
}
